package com.budwk.app.sqfwDoc.dto;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.budwk.starter.common.openapi.annotation.ApiModel;
import com.budwk.starter.common.openapi.annotation.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author ZY.Wang
 * @since 2023/12/29
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServerCodeConfigDTO {

    @ApiModelProperty(description = "第五张表总的类型(垃圾分类，安全排查等)")
    private String formSummaryTypeCode;

    @ApiModelProperty(description = "pdf创建完成之后通知")
    private String pdfCreateFinishSocketCode;

    @ApiModelProperty(description = "包名字")
    private String packageName;

    @ApiModelProperty(description = "controller url路径")
    private String controllerUrlPath;

    @ApiModelProperty(description = "pdf配置列表")
    private List<PdfInfoConfig> pdfInfoConfigList;

    @ApiModelProperty(description = "excel配置列表")
    private List<ExcelInfoConfig> excelInfoConfigList;

    @Data
    public static class PdfInfoConfig {
        private String templateDesc;
        private String templateName;
        private String generatorClassName;
        private String templateFileUrl;
        private String originalFileUrl;
        private templateOpsConfig templateOpsConfig;
        private List<FileFieldConfig> fileFieldConfigList;

        private JSONObject templateOpsConfigJson;
        private JSONArray fileFieldConfigListJson;
    }

    @Data
    public static class ExcelInfoConfig {
        private String templateDesc;
        private String templateName;
        private String generatorClassName;
        private String templateFileUrl;
        private String originalFileUrl;
        private templateOpsConfig templateOpsConfig;
        private List<FileFieldConfig> fileFieldConfigList;

        private JSONObject templateOpsConfigJson;
        private JSONArray fileFieldConfigListJson;
    }

    @Data
    @ApiModel(description = "模板创建条件配置")
    public static class templateOpsConfig {
        List<String> associatedFieldCodeList;
        String opsConfig;
    }

    @Data
    @ApiModel(description = "文件中出现的字段逻辑配置")
    public static class FileFieldConfig {
        private String fieldName;
        private String defaultFieldValue;
        private String pseudoCodeContent;
        private List<String> associatedFieldCodeList;
    }
}
